import request from '@/utils/request'

export function getAllType() {
  return request({
    url: `/course_type/get`,
    method: 'get'
  })
}

export function getTypeReq(pageNum:number, pageSize:number) {
    return request({
      url: `/course_type/get/${pageNum}/${pageSize}`,
      method: 'get'
    })
}

export function addType(type:string) {
  return request({
    url: `/course_type/add?type=${type}`,
    method: 'post'
  })
}

export function editType(id:string, type:string) {
  return request({
    url: `/course_type/update/${id}?type=${type}`,
    method: 'put'
  })
}

export function deleteType(id:string) {
  return request({
    url: `/course_type/del/${id}`,
    method: 'delete'
  })
}

export function searchTypeByName(name:string) {
  return request({
    url: `/course_type/get/${name}`,
    method: 'get'
  })
}